package com.spsy.pay.lisener;

import com.rabbitmq.client.Channel;
import com.spsy.pay.constant.RabbitMqConstant;
import com.spsy.pay.constant.RabbitMqConstantCompany;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;


/**
 * @author 沈昕希  &&  (=￣ω￣=)m
 * @Shen "再说错了又能怎么样呢？人生不就是由无数的错误组成的吗"
 * @xin "我是个无聊的人，我有无数的缺点，我也并不喜欢我自己，甚至厌恶我自己"
 * @date 2025/9/26-17:21
 */
@Component
@RabbitListener(queues = RabbitMqConstantCompany.MQ_NAME)
@Slf4j
public class RabbitLisenerCompany {


    @RabbitHandler
    public void  handler(String str, Channel channel, Message message) throws Exception {
        log.info("接收到的消息是："+str);

        //sucess
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),true);

//        channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,false);
//
//        channel.basicNack(message.getMessageProperties().getDeliveryTag(),false,true);


    }
}
